﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HitachiLib.Data;

namespace HitachiApp.Model
{
    public class ScheduleListViewModel : INotifyPropertyChanged
    {
        ScheduleUnitWeekControlModel week;

        public ScheduleListViewModel(DateTime datetime, int type, ScheduleTabViewModel parent_model)
        {
            week = new ScheduleUnitWeekControlModel(datetime, type, parent_model);
        }

        public ScheduleUnitWeekControlModel Week
        {
            get { return week; }
        }

        public DateTime StartTime
        {
            get { return week.StartTime; }
        }

        public void Clear()
        {
            week.Clear();
            RaisePropertyChanged("Size");
        }

        public void Cleanup()
        {
            week.Cleanup();
            RaisePropertyChanged("Size");
        }

        public void Add(Project p)
        {
            ViewItem vi = new ViewItem(p, week.Common);
            week.Add(vi);
            RaisePropertyChanged("Size");
        }

        public int Size
        {
            get { return Week.Size; }
        }

        #region PropertChanged Block
        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
        #endregion
    }
}
